<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="imagetoolbar" content="no"> <!--ie image gizmo OFF!-->
    <style type="text/css">
        #map {
            width: 512px;
            height: 512px;
            border: 1px solid black;
        }
    </style>
    <script src="../lib/OpenLayers.js"></script>
    <script type="text/javascript">
        <!--
        var map, layer, popup;

        var marker, markers;

        function init(){
            map = new OpenLayers.Map('map');
            layer = new OpenLayers.Layer.WMS( "OpenLayers WMS", 
                "http://labs.metacarta.com/wms/vmap0", {layers: 'basic'} );
                

            map.addLayer(
            new OpenLayers.Layer.WMS("NASA Mosaic", 
                         "http://wms.jpl.nasa.gov/wms.cgi",
                         {"EXCEPTIONS" : "application/vnd.ogc.se_inimage",
                          "format" : "image/jpeg",
                          layers:"modis,global_mosaic"}
                         ));

            map.addLayer(layer);

            markers = new OpenLayers.Layer.Markers( "Markers" );
            map.addLayer(markers);

            map.addControl(new OpenLayers.Control.LayerSwitcher());
            map.zoomToFullExtent();
        }
        
        function changer() {
            var lon = map.getLonLatFromLayerPx(new OpenLayers.Pixel(0,0)).lon;
            var lat = map.getLonLatFromLayerPx(new OpenLayers.Pixel(0,0)).lat;
            var slon = map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)).lon;
            var slat = map.getLonLatFromViewPortPx(new OpenLayers.Pixel(0,0)).lat;
            alert("lon=" + lon + " lat=" + lat 
                  + "slon=" + slon + " slat=" + slat);
        }

        function add() {
            var icon = new OpenLayers.Icon('http://boston.openguides.org/markers/AQUA.png',new OpenLayers.Size(10,17));
            marker = new OpenLayers.Marker(new OpenLayers.LonLat(0,00), icon);
            markers.addMarker(marker);
            
        }        
        
        function destroy() {
            popup.destroy();
        }

        function remove() {
            map.removePopup(popup);
        }


        // -->
    </script>
  </head>
  <body onload="init()">
    <h1>OpenLayers Example</h1>
    <div id="map"></div>
    <div style="background-color:purple" onclick="add()"> click to add popup to map</div>
    <div style="background-color:blue" onclick="changer()"> click to get lon/lat for pixel point(0,0)</div>
    <div style="background-color:red" onclick="destroy()"> click to destroy the popup</div>
    <div style="background-color:green" onclick="remove()"> click to remove the popup from map</div>
  </body>
</html>
